package twentytwenty;

import java.util.Arrays;

/**
 * @Author: Zahi
 * @Description:
 * @Date Created in 2020-12-11 15:55
 * @Modified By:
 */
public class MoveZeroes_283 {
    public static void main(String[] args) {
        int [] nums = new int[]{0,1,0,3,12};
        moveZeroes(nums);
        System.out.println(Arrays.toString(nums));
    }

    public static void moveZeroes(int[] nums) {
        int len = nums.length;
        for (int i = 0; i < len; i++) {
            for (int j = i + 1; j < len; j++) {
                if (nums[i] == 0){
                    int temp = nums[i];
                    nums[i] = nums[j];
                    nums[j] = temp;
                }else {
                    break;
                }
            }
        }
    }
}
